# plot f(x) = sin^2(x-2)e^{-x^2}
import matplotlib.pyplot as plt #调用两个库
import numpy as np

plt.rcParams["font.sans-serif"] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False  

x = np.linspace(-2.5, 2, 256, endpoint=True)  

f = (np.sin(x - 2)) ** 2 * (np.e) ** (-x ** 2)  

plt.plot(x, f, "g-", lw=2.5, label="f(x)")
plt.title('f(x) = sin^2(x-2)e^{-x^2}')
plt.legend()
plt.show()

